package com.example.sqldealtool.learnTry;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;

import java.nio.charset.StandardCharsets;
import java.util.Objects;

/**
 * @author: xjc
 * @date: 2023/4/20 17:07
 **/
public class StringTry {
    public static void main(String[] args) {
//        String chinese = "补充本问题的关联问题";
//        String chars = "1234567890";
//        System.out.println(chars.getBytes(StandardCharsets.UTF_8).length);
//        System.out.println(chinese.getBytes(StandardCharsets.UTF_8).length);
//
//        String spilstr = "镜头test（转码后）--1--测试第三次--0-----333";
//        String[] a = spilstr.split("--");
//        System.out.println(a[a.length - 1].replaceAll("-", ""));
//        System.out.println(a[a.length - 1]);
//        String pathOne = "/mnt/data/remote/amam/temp/Upload/UploadDocument/00000001/5f39f5d3fcad477b8631235a3811bff3.docx";
//        String pathTwo = "/mnt/data/remote/amam/temp/Upload/UploadDocument/00000001/f18d05d3bb6194b6afc76077e1e6fbab.xlsx";
//        System.out.println(FilenameUtils.getExtension(pathOne));
//        spilstr = spilstr + FilenameUtils.getExtension(pathTwo);
//        System.out.println(spilstr);
//        doSyncFileByAllTime();
        String a = " ";
        String b = "\n";
        String c = "\t";
        System.out.println("a:"+StringUtils.isBlank(a));
        System.out.println("b:"+StringUtils.isBlank(b));
        System.out.println("c:"+StringUtils.isBlank(c));
    }

    public static void doSyncFileByAllTime() {

        Long toDealFileObjectId = 580000L;
        Long endId = 3180001L;
        long total = 0;
        /**
         * 从待处理id开始，每次取1000条数据进行同步，默认同步5000次，（避免死循环）
         * 有异常则抛出,并记录当前执行的素材id
         */
        Integer threadCount = 10;
        do {
            total += threadCount;
            toDealFileObjectId += (1000 * threadCount);
        } while (toDealFileObjectId < endId && total < 5000);
        System.out.println("toDealFileObjectId:" + toDealFileObjectId + "\ntotal:" + total);
    }
}
